package com.zlm.user.emp.receiver;

import com.zlm.amqp.conf.RabbitConfig;
import com.zlm.user.emp.service.SysEmpService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: duyufu
 * @Date: 2019/7/5 15:02
 */
@Component
@RabbitListener(queues = RabbitConfig.HX_EMP_REGISTER)
public class HxEmpRegisterReceiver {

    @Autowired
    private SysEmpService sysEmpService;

    @RabbitHandler
    public void process(String message) {
        String[] split = message.split("&&");
        Integer empId = Integer.valueOf(split[0]);
        String hxID = split[1];
        String hxPassword = split[2];
        sysEmpService.updateHxPasswordByEmpId(empId,hxID,hxPassword);

        System.out.println("receiver:"+ message);

    }

}
